import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

export default defineConfig({
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },
  plugins: [vue()],
  server: {
    host: 'localhost',
    port: 8080,
    cors: true,
    proxy: {
      // 代理
      // '/demo1-images': 'http://localhost:8080'
    }
  },
  build: {
    outDir: './main-vite', // 打包地址
    rollupOptions: {
      output: {
        chunkFileNames: 'common/js/[name]-[hash].js',
        entryFileNames: 'common/js/[name]-[hash].js',
        assetFileNames: 'common/[ext]/[name]-[hash].[ext]'
      }
    }
  }
})
